<?php
/**
 * Created by JetBrains PhpStorm.
 * User: Administrator
 * Date: 12-10-14
 * Time: 下午10:39
 * To change this template use File | Settings | File Templates.
 */
class ModelCatalogPackage extends Model {
    public function getPackages($data = array()) {
//        $package_data = array();

        $sql = "SELECT * FROM " . DB_PREFIX . "package";
        $query = $this->db->query($sql);
        return $query->rows;

//        foreach ($query->rows as $result) {
//            $package_values = array();
//            $values = $this->db->query("SELECT * FROM " . DB_PREFIX . "package_value WHERE package_id = '" . (int)$result['id'] . "'");
//               foreach ($values->rows as $value) {
//                   $package_values[]= array(
//                    'name' => $value['name'],
//                    'month_price' => $value['month_price'],
//                    'return_money' => $value['return_money'],
//                    'give_money' => $value['give_money'],
//                    'time'  => $value['time']
//                );
//
//            $package_data[$result['id']] = array(
//                'package_id' => $result['id'],
//                 'package_name' => $result['name'],
//                 'description' => $result['description'],
//                'package_values'=>$package_values
//            );
//
//        }
//        return $package_data;
//    }
    }

    public  function  getPackageValuse(){
        $sql = "SELECT * FROM " . DB_PREFIX . "package_value";
        $query = $this->db->query($sql);
        return $query->rows;
    }
}